package com.sparrow.common.ai.behaviortree.task.impl;

import com.sparrow.common.ai.behaviortree.BehaviorContext;
import com.sparrow.common.ai.behaviortree.def.BTNodeStatus;
import com.sparrow.common.ai.behaviortree.node.impl.ActionNode;
import com.sparrow.common.ai.behaviortree.task.BehaviorTask;

public class ActionTask extends BehaviorTask {

    private final ActionNode node;

    public ActionTask(ActionNode node) {
        this.node = node;
    }

    @Override
    public BTNodeStatus tick(BehaviorContext context, long now, long delta) {
        enterTick(context);
        return this.node.tick(context, now, delta);
    }

    @Override
    public String toString() {
        return "ActionTask{" +
                "node=" + node.getClass().getSimpleName() +
                '}';
    }
}
